NumericFunctions.Regex occurrences function

Returns the number of times a pattern occurs in another string

Format

ANSI-SQL Format:

OCCURRENCES_REGEX( Pattern, [ FLAG Options ] IN Subject [ FROM Start ] )

Remarks

Returns the number of times the Pattern occurs in Subject.

Pattern is the regular expression string to search for. For more information on regular expression patterns, refer to Regular Expressions.

If specified, the Option argument changes the pattern matching behaviour. For more information on regular expression options refer to Regular Expression Option Flags.

Subject is the string to be searched.

If specified, the Start argument is the 1-based offset into Subject to start the search. If Start is less than 1 or greater than the length of Subject, the function returns -1. If Start is not specified, the starting position is assumed to be 1, which is the first character in Subject

Example:

OCCURRENCES_REGEX( 'a.b' IN 'aab abb acb adb' ) returns 4

If you reference system status tags in your ST programs, you need to prefix the names of those system status tags with an additional caret '^' escape character. This escapes the reserved caret '^' character that is used at the start of the names of system status tags (also known as 'status attributes') (see Access System Status Information).

For example:

VAR

sServerStateTime AT %M(^^<server name>.ServerStateTime): DATE_AND_TIME;

END_VAR


Disclaimer

Geo SCADA Expert 2020